from django.db import models


# Create your models here.

class Login(models.Model):
    username = models.CharField(max_length=20, unique=True)
    password = models.CharField(max_length=40)


class Bill(models.Model):
    company_name = models.CharField(max_length=20)
    date = models.DateTimeField()
    price = models.DecimalField(max_digits=7, decimal_places=2)
    num = models.IntegerField()
    product_name = models.CharField(max_length=20)


class Clerk(models.Model):
    clerk_name = models.CharField(max_length=20)
    age = models.IntegerField()
    gender = models.BooleanField(default=0)
    seniority = models.IntegerField()
    phone = models.IntegerField()


class Region(models.Model):
    place_name = models.CharField(max_length=20)
    postcode = models.IntegerField()


class Client(models.Model):
    company_name = models.ForeignKey(to=Bill, on_delete=models.SET_NULL, null=True, blank=True)
    business = models.CharField(max_length=40)
    region = models.ForeignKey(to=Region, on_delete=models.SET_NULL, null=True, blank=True)
    contact = models.CharField(max_length=20)
    job = models.CharField(max_length=20)
    phone = models.IntegerField()
    gender = models.BooleanField(default=0)
    fax = models.IntegerField()
    bank = models.IntegerField()
    postcode = models.IntegerField()
    scale = models.CharField(max_length=40)
    clerk = models.ForeignKey(to=Clerk, on_delete=models.SET_NULL, null=True, blank=True)
    is_show = models.BooleanField(default=0)
    date = models.DateField()
